#include <iostream>
#include <string>
using namespace std;

class Student{
protected:
    string id;
    double grade;

public:
    Student(){}
    Student(string id,double grade){
        this->id=id;
        this->grade=grade;
    }
    ~Student(){
        cout<<"Student 对象 "<<this<<" 被销毁"<<endl;
    }
    double getGrade(){return grade;}
    void setGrade(double grade){this->grade=grade;}
    string getId(){return id;}
    void setId(string id){this->id=id;}
};

class Teacher{
protected:    
    string job;
    string department;

public: 
    Teacher(){}
    Teacher(string job,string department){
        this->job=job;
        this->department=department;
    }

    ~Teacher(){
        cout<<"Teacher 对象 "<<this<<" 被销毁"<<endl;
    }

    string getJob(){return job;}
    void setJob(string job){this->job=job;}
    string getDepartment(){return department;}
    void setDepartment(string department){
        this->department=department;
    }
};

class GradOnWork:public Student,public Teacher{
    string researchDirection;
    string supervisor;
public:
    GradOnWork(
        string id,double grade,
        string job,string department,
        string researchDirection,string supervisor)
        :Student(id,grade),
        Teacher(job,department){
            this->researchDirection=researchDirection;
            this->supervisor=supervisor;
        }
    ~GradOnWork(){
        cout<<"GradOnWork 对象 "<<this<<" 被销毁"<<endl;
    }

    string getSupervisor(){return supervisor;}
    void setSupervisor(string supervisor){this->supervisor=supervisor;}
    string getResearchDirection(){return researchDirection;}
    void setResearchDirection(string researchDirection){
        this->researchDirection=researchDirection;
    }

    string toString(){
        return "GradOnWord{学号:"+id
            +" ,成绩:"+to_string(grade)
            +" ,职称:"+job
            +" ,所在系:"+department
            +" ,研究方向:"+researchDirection
            +" ,指导老师:"+supervisor+"}";
    }
};

int main(){
    GradOnWork gdonwk("2019001", 90.5,
         "教授", "计算机系", "机器学习", "李老师");
    cout<<gdonwk.toString()<<endl;
    return 0;
}